package com.brillilab.service.core.method.impl;

import java.util.List;

import javax.annotation.Resource;

import com.brillilab.domain.vo.method.MethodTypePowerVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.brillilab.dao.mapper.method.MethodTypePowerMapper;
import com.brillilab.domain.po.method.MethodTypePower;
import com.brillilab.service.core.method.IMethodTypePowerService;

/**
 * @author wuzhiyu
 * @Title: MethodTypePowerServiceImpl
 * @ProjectName brill_lab
 * @Description: TODO
 * @date 2019/2/2216:22
 */
@Service
@Transactional
public class MethodTypePowerServiceImpl implements IMethodTypePowerService {

	@Resource
    private MethodTypePowerMapper methodTypePowerMapper;
	
    @Override
    public MethodTypePower getByTypeId(Long typeId) {
        return methodTypePowerMapper.selectById(typeId);
    }

	@Override
	public List<MethodTypePower> getPowerList(Long labMemberId) {
		LambdaQueryWrapper<MethodTypePower> wrapper = new LambdaQueryWrapper<>();
		wrapper.eq(MethodTypePower::getLabMemberId, labMemberId);
		return methodTypePowerMapper.selectList(wrapper);
	}

	@Override
	public List<MethodTypePowerVo> selectMethodTypePowerVo(Long labMemberid){
		return methodTypePowerMapper.selectMethodTypeByMemberId(labMemberid);
	}

	@Override
	public List<MethodTypePowerVo> selectAllFirstMethodType(){
    	return methodTypePowerMapper.selectAllFirstMethodList();
	}

	@Override
	public boolean deleteByLabMemberId(Long labmemberid){
		return methodTypePowerMapper.deleteByLabMemberId(labmemberid) > 0;
	}

	@Override
	public int addMethodTypePower(MethodTypePower methodTypePower){
		return methodTypePowerMapper.insert(methodTypePower);
	}

	@Override
	public List<MethodTypePower> selectMethodTypePower(Long labmemberid){
    	return methodTypePowerMapper.selectMethodTypePower(labmemberid);
	}

	@Override
	public boolean addMethodTypePower(List<MethodTypePower> list){
    	return methodTypePowerMapper.addMethodTypePowerBatch(list) > 0;
	}
}
